package com.douwong.student.enums;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * @autor yichao
 * @time 2016/8/2615:03
 * @des 返回的编码
 */
public enum  E_Code {
    /// 成功
    ok(0),

    /// 程序报错

    error(1),
    /// 未找到网络资源
    http404(2);


    private    int value;

         E_Code(int value) {
        this.value=value;
    }
    @JsonValue
    public int getValue() {
        return value;
    }
    @JsonCreator
    public static E_Code getItem(int value){
    for(E_Code item :values()){
        if (item.getValue()==value){
            return item;
        }
    }
    return null;
}

}
